<!-- #include file="function.asp" -->
<%
'注册插件
Call RegisterPlugin("xnxf_Fix404","ActivePlugin_xnxf_Fix404")
'挂口部分
Function ActivePlugin_xnxf_Fix404()
  Call Add_Filter_Plugin("Filter_Plugin_TArticleList_Export_TemplateTags","Fix404_Run")
  Call Add_Filter_Plugin("Filter_Plugin_TArticleList_Build_Template_Succeed","Fix404_Run2")
  Call Add_Filter_Plugin("Filter_Plugin_TFunction_Post","Fix404_Run3")
End Function

Function Fix404_Run(Name,Byref Value)
  If Value(11) > Value(12) Or Value(1) = "" Then
    Response.Status="404 Not Found"
    Response.End
  End If
  If BlogHost <> "http://www.wdssmq.com/" Then Exit Function
  ' Dim objRegExp
  ' Set objRegExp=New RegExp
  ' objRegExp.IgnoreCase=True
  ' objRegExp.Global=True
  ' objRegExp.Pattern="/default_(\d+).html|_(\d+)/"
  ' If objRegExp.Test(Value(2)) Then
    ' Value(2) = objRegExp.Replace(Value(2), "/$1$2/")
    ' Value(1) = Value(2)
  ' End If
  ' Set objRegExp=Nothing
End Function

Function Fix404_Run2(html)
  If InStr(html,"<#template:article-multi#>") > 0 Then
    Response.Status="404 Not Found"
    Response.End
  End If
End Function

Function Fix404_Run3(ID,Name,FileName,Order,Byref Content,IsHidden,SidebarID,HtmlID,Ftype,MaxLi,Source,ViewType,IsHideTitle,MetaString)
  If FileName <> "calendar" Then Exit Function
  If FileName = "calendar" Then
    Dim dtmYearMonth,y,m,t
    Call CheckParameter(dtmYearMonth,"dtm",Date())
    y=year(dtmYearMonth)
    m=month(dtmYearMonth)
    t=UrlbyDateAuto(y,m+1,"")
    If m=12 Then t=UrlbyDateAuto(y+1,1,"")
    Content = Replace(Content,"<a href="""&t&""">&#00187;</a>","&nbsp;&nbsp;")

    Dim Re
    Re="catalog.asp\?date=([0-9\-]+)"
    
    Dim Rw
    Rw=Replace(ZC_DATE_REGEX,"{%date%}","$1")
    Rw=Replace(Rw,"{%host%}/","")
    Rw=Replace(Rw,"default.html","")
    
    Dim objRegExp
    Set objRegExp=New RegExp
    objRegExp.IgnoreCase=True
    objRegExp.Global=True
    objRegExp.Pattern=Re
    If objRegExp.Test(Content) Then
      Content =  objRegExp.Replace(Content, Rw)
    End If
    Set objRegExp=Nothing
    ' Call SaveToFile(BlogPath & "test/"&FileName&".html",Content,"utf-8",False)
  End If

End Function


Function InstallPlugin_xnxf_Fix404()

	'用户激活插件之后的操作

End Function


Function UnInstallPlugin_xnxf_Fix404()

	'用户停用插件之后的操作

End Function
%>